package com.watchthelan.web.administrator;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.watchthelan.domain.Administrator;
import com.watchthelan.service.administrator.AdministratorManager;

public class AdministratorsController implements Controller {
	private final Log logger = LogFactory.getLog(this.getClass());
	private AdministratorManager administratorManager;
	
	public void setAdministratorManager(AdministratorManager administratorManager) {
		this.administratorManager = administratorManager;
	}

	public ModelAndView handleRequest(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
		Map<String, Object> myModel = new HashMap<String, Object>();		
		List<Administrator> administrators = this.administratorManager.getAdministrators();
		myModel.put("administrators", this.administratorManager.getAdministrators());
		return new ModelAndView("administrators", "model", myModel);
	}
}
